package top.layne.boot.samples.swagger.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import top.layne.boot.samples.swagger.entity.TUser;
import top.layne.boot.samples.swagger.service.ITUserService;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author layne
 * @since 2019-05-18
 */
@RestController
@RequestMapping("/swagger/t-user")
@Api(tags = "用户管理")
public class TUserController {

    @Resource
    private ITUserService itUserService;

    @ApiOperation(value = "查询用户列表")
    @GetMapping("query")
    public Object query(){
        List<TUser> tUsers = itUserService.list();
        return tUsers;
    }

    @ApiOperation(value = "插入用户信息")
    @PostMapping("insert")
    public Object insert(@RequestBody TUser tUser){
        itUserService.save(tUser);
        return null;
    }

}

